#include "shape.hpp"

Shape::Shape()
{
    std::cout << __FUNCTION__ << " called." << std::endl;
    system("pause");
}
Shape::~Shape()
{
    std::cout << __FUNCTION__ << " called." << std::endl;
    system("pause");
}
double Shape::area()
{
    throw NotImplemented();
}
Rectangle::Rectangle(double w, double h) : Shape(), width(w), height(h)
{
    std::cout << __FUNCTION__ << " called." << std::endl;
    system("pause");
}
Rectangle::~Rectangle()
{
    std::cout << __FUNCTION__ << " called." << std::endl;
    system("pause");
}
double Rectangle::area()
{
    return width * height;
}
std::istream &operator>>(std::istream &in, Rectangle &r)
{
    std::cout << "Please input Rectangle's width and height:" << std::endl;
    in >> r.width >> r.height;
    return in;
};
Square::Square(double l) : Rectangle(l, l)
{
    std::cout << __FUNCTION__ << " called." << std::endl;
    system("pause");
}
Square::~Square()
{
    std::cout << __FUNCTION__ << " called." << std::endl;
    system("pause");
}
std::istream &operator>>(std::istream &in, Square &s)
{
    std::cout << "Please input Square's side:" << std::endl;
    in >> s.width;
    s.height = s.width;
    return in;
};
Circle::Circle(double r) : Shape(), radius(r)
{
    std::cout << __FUNCTION__ << " called." << std::endl;
    system("pause");
}
Circle::~Circle()
{
    std::cout << __FUNCTION__ << " called." << std::endl;
    system("pause");
}
double Circle::area()
{
    return M_PI * radius * radius;
}
std::istream &operator>>(std::istream &in, Circle &c)
{
    std::cout << "Please input Circle's radius:" << std::endl;
    in >> c.radius;
    return in;
};